mruby
4.0.0
mruby is the lightweight implementation of the Ruby language
Loading...
Searching...
No Matches
include
mruby
presym.h
Go to the documentation of this file.
1
6
7
#ifndef MRUBY_PRESYM_H
8
#define MRUBY_PRESYM_H
9
10
#if !defined(MRB_PRESYM_SCANNING)
11
12
#include <mruby/presym/id.h>
13
14
/*
15
* Where `mrb_intern_lit` is allowed for symbol interning, it is directly
16
* replaced by the symbol ID using the following macros.
17
*
18
* MRB_OPSYM(xor) //=> ^ (Operator)
19
* MRB_GVSYM(xor) //=> $xor (Global Variable)
20
* MRB_CVSYM(xor) //=> @@xor (Class Variable)
21
* MRB_IVSYM(xor) //=> @xor (Instance Variable)
22
* MRB_SYM_B(xor) //=> xor! (Method with Bang)
23
* MRB_SYM_Q(xor) //=> xor? (Method with Question mark)
24
* MRB_SYM_E(xor) //=> xor= (Method with Equal)
25
* MRB_SYM(xor) //=> xor (Word characters)
26
*
27
* For `MRB_OPSYM`, specify the names corresponding to operators (see
28
* `MRuby::Presym::OPERATORS` in `lib/mruby/presym.rb` for the names that
29
* can be specified for it). Other than that, describe only word characters
30
* excluding leading and ending punctuation.
31
*
32
* These macros are expanded to compile-time integer constants.
33
*/
34
35
#define MRB_OPSYM(name) MRB_OPSYM__##name
36
#define MRB_GVSYM(name) MRB_GVSYM__##name
37
#define MRB_CVSYM(name) MRB_CVSYM__##name
38
#define MRB_IVSYM(name) MRB_IVSYM__##name
39
#define MRB_SYM_B(name) MRB_SYM_B__##name
40
#define MRB_SYM_Q(name) MRB_SYM_Q__##name
41
#define MRB_SYM_E(name) MRB_SYM_E__##name
42
#define MRB_SYM(name) MRB_SYM__##name
43
44
/* backward compatibility: _2 variants accept but ignore mrb_state* */
45
#define MRB_OPSYM_2(mrb, name) MRB_OPSYM(name)
46
#define MRB_GVSYM_2(mrb, name) MRB_GVSYM(name)
47
#define MRB_CVSYM_2(mrb, name) MRB_CVSYM(name)
48
#define MRB_IVSYM_2(mrb, name) MRB_IVSYM(name)
49
#define MRB_SYM_B_2(mrb, name) MRB_SYM_B(name)
50
#define MRB_SYM_Q_2(mrb, name) MRB_SYM_Q(name)
51
#define MRB_SYM_E_2(mrb, name) MRB_SYM_E(name)
52
#define MRB_SYM_2(mrb, name) MRB_SYM(name)
53
54
#define MRB_PRESYM_DEFINE_VAR_AND_INITER(name, size, ...) \
55
static const mrb_sym name[] = {__VA_ARGS__};
56
57
#define MRB_PRESYM_INIT_SYMBOLS(mrb, name) (void)(mrb)
58
59
/* use MRB_SYM() for E_RUNTIME_ERROR etc. */
60
#undef MRB_ERROR_SYM
61
#define MRB_ERROR_SYM(sym) MRB_SYM(sym)
62
63
#endif
/* !MRB_PRESYM_SCANNING */
64
65
#endif
/* MRUBY_PRESYM_H */
Generated by
1.13.2